/*
 * @Author: panzhiwei 749458928@qq.com
 * @Date: 2024-01-31 11:39:50
 * @LastEditors: panzhiwei 749458928@qq.com
 * @LastEditTime: 2024-02-01 17:59:31
 * @FilePath: /2DDemo/assets/Script/weapon/SmallRocket.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { _decorator, Collider2D, IPhysics2DContact } from 'cc';
import { RocketCrossbow } from './RocketCrossbow';
const { ccclass, property } = _decorator;

@ccclass('SmallRocket')
export class SmallRocket extends RocketCrossbow {

    onLoad() {
        super.onLoad(); // 调用父类的 onLoad 方法
        // 初始化 SmallRocket 特有的逻辑
        this.shootingSpeed = this.shootingSpeed / 5;
    }

    // 重写或添加方法，例如 onBeginContact
    onBeginContact(selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
        // 检查是否与敌人碰撞
        if (otherCollider.node.name === 'Enemy') {
            // let enemyScript = otherCollider.node.getComponent(Enemy);
            // if (enemyScript) {
            //     enemyScript.explosionTakeDamage(this.attackPower);
            //     // 可选：销毁 SmallRocket
            //     this.node.destroy();
            // }
        }
    }

    start() {

    }

    update(deltaTime: number) {
        
    }
}

